package com.cloudcc.mobile.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.cloudcc.mobile.database.LoginDBUser.Users;

/**
 * 数据库辅助类
 */
public class LoginDBOpenHelper extends SQLiteOpenHelper {
	public static final int DB_VERSION = 1;
	public static final String DB_NAME = "login.db";
	public static final String USER_TABLE_NAME = "user_table";

	public LoginDBOpenHelper(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
	}

//	@Override
//	public void onCreate(SQLiteDatabase db) {
//		db.execSQL("create table " + USER_TABLE_NAME + " (" + Users._ID
//				+ " integer primary key," + Users.USERNAME + " text, "
//				+ Users.PASSWORD + " text, " + Users.ISSAVED + " INTEGER,"+Users.ISAUTO+" INTEGER)");
//	}
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("create table " + USER_TABLE_NAME + " (" + Users._ID
				+ " integer primary key," + Users.USERNAME + " text, "
				+ Users.PASSWORD + " text) ");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + USER_TABLE_NAME);
		onCreate(db);
	}

}


